package k2_oop.p6_relation.demo09;

/**
 * 定义SalariedEmployee类继承Employee类，实现按月计算工资的员工处理。该类包括：
 * 	private成员变量monthlySalary；
 * 实现父类的抽象方法earnings(),该方法返回monthlySalary值
 * display()方法输出员工类型信息及员工的name，number,birthday
 */
public class SalariedEmployee extends Employee{

    private double monthlySalary;

    public SalariedEmployee(String name, String number, MyDate birthday, double monthlySalary) {
        super(name, number, birthday);
        this.monthlySalary = monthlySalary;
    }

    @Override
    public double earnings(int month) {
        if(month==this.getBirthday().getMonth()){
            return this.monthlySalary+100;
        }
        return this.monthlySalary;
    }

    @Override
    public void display() {
        System.out.println("按月发工资的员工");
        super.display();
    }
}
